<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019-01-29
 * Time: 15:08
 */

namespace app\index\controller;


use app\common\controller\HomeBase;
use app\common\model\Messagem;
use app\common\model\Systems;

class System extends HomeBase
{
    /**
     * 获取客服信息
     */
    public function getSystemInfo()
    {
        $data = Systems::getIofo();
        $data['s_photo'] = 'http://'.$_SERVER['HTTP_HOST'].$data['s_photo'];
        return json(['code' =>200,  'msg' => $data]);
    }

    /**
     * 系统会员列表
     */
    public function memberlist()
    {
        $list = Systems::getMemberList();
        if (!$list) {
            return json(['code' =>301,  'msg' => '暂无数据']);
        }
        return json(['code' =>200,  'msg' => $list]);
    }
    /**
     * 用户开通会员的记录列表
     */
    public function openmemberlist($page = 1)
    {
        $params = input();
        if(array_key_exists("u_id",$params) && $params['u_id'] != ''){
            $list = Messagem::openMemberList($params['u_id'], $page);
            if (sizeof($list) > 0) {
                return json(['code' =>200,  'msg' => $list]);
            }
            return json(['code' =>300,  'msg' => '暂无数据']);
        } else {
            return json(['code' =>301,  'msg' => '未登录']);
        }

    }
}